package me.xplabs.view 
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.utils.getQualifiedClassName;
	import me.xplabs.Globals;
	import me.xplabs.interfaces.IBasePanel;
	import me.xplabs.model.msg.MsgChangeRaidInfo;
	import me.xplabs.model.proxy.EnergyWaveProxy;
	import me.xplabs.model.proxy.RaidInfoProxy;
	import me.xplabs.msg.NotificationName;
	import me.xplabs.msg.NotificationRaidInfo;
	import me.xplabs.ui.UICompent;
	import me.xplabs.ui.baseui.Label;
	import me.xplabs.view.player.RaidBaseInfoView;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	/**
	 * http://www.xplabs.me/
	 * @author xiaohan
	 */
	public class RaidInfoViewMediator extends  Mediator implements IBasePanel 
	{
		public static var NAME:String;
		private var _container:Sprite;
		private var _isInit:Boolean;
		
		//private var _raidInfoProxy:RaidInfoProxy;
		private var _raidInfoView:RaidBaseInfoView;
		private var _raidMenuView:RaidMenuView;
		private var _propertyView:PropertyView;
		public function RaidInfoViewMediator(viewComponent:Object=null) 
		{
			NAME = getQualifiedClassName(this);
			super(NAME, viewComponent);
			//_raidInfoProxy = RaidInfoProxy(facade.retrieveProxy(RaidInfoProxy.NAME));
		}
		
		private function init():void
		{
			if (_isInit) return;
			_isInit = true;
			_container = new Sprite();
			
			_raidInfoView = new RaidBaseInfoView(_container);
			_raidInfoView.show();
			
			_raidMenuView = new RaidMenuView(_container);
			_raidMenuView.show();
			_raidMenuView.setXY(544, 10);
		
		}
		public function show():void 
		{
			init();
			if (!_container.parent) viewComponent.addChild(_container);
		}
		
		public function hide():void 
		{
			if (_container.parent) _container.parent.removeChild(_container);
		}
		override public function listNotificationInterests():Array 
		{
			return [NotificationName.VIEW_SHOW_RAIDINFO, NotificationName.VIEW_HIDE_RAIDINFO];
		}
		override public function handleNotification(notification:INotification):void 
		{
			switch(notification.getName())
			{
				case NotificationName.VIEW_SHOW_RAIDINFO:
					show();
					sendNotification(NotificationName.UPDATE_RAIDINFO, null, NotificationRaidInfo.INIT_VIEW_RAIDINFO);
					break;
				case NotificationName.VIEW_HIDE_RAIDINFO:
					hide();
					break;
			}
		}

		public function dispose():void 
		{
			
		}
		
		public function get raidInfoView():RaidBaseInfoView 
		{
			return _raidInfoView;
		}
	}

}